public class Demo {

    public static void main(String[] args) {
        sum();
        sum(1);
        sum(1, 2);
        sum(1, 2, 3);
        sum(1, 2, 3, 4);
        sum(1, 2, 3, 4, 5);
    }

    public static void sum(int... numbers) {
        int result = 0;
        for (int i = 0; i < numbers.length; i++) {
            result += numbers[i];
        }
        System.out.println(result);
    }

}
